#
# AI Events
#
#   written by 
#		Celedhring 
#		Henrik Fhraeus
#		Johan Andersson
#
#

############################################################################################
#GERMANY
############################################################################################

#GERMANY PREPARES INVASION OF BRITAIN#

event = {
	id = 10001
	random = no
	country = GER
	
	trigger = {
      	ai = yes     
		war = { country = GER country = ENG }
      	control = { province = 527 data = GER } # Germany controls Paris
		control = { province = 643 data = GER } # Germany controls Warszawa
		NOT = {
			war = { country = GER country = SOV }
		}
	}

	name = "AI_EVENT"
	desc = ""
	style = 0
	
	date = { day = 1 month = september year = 1936 }
	offset = 3 # Check for trigger conditions every 3 days
	deathdate = { day = 30 month = december year = 1947 }
	
	action_a = {
				command = { type = ai which = "germany_bob.ai" }
	}
}
		

#GERMANY SWITCHES TO BARBAROSSA BUILDUP - UK STILL UNDEFEATED#

event = {
	id = 10002
	random = no 
	country = GER
	
	trigger = {
		random = 10 # # Germany should not automatically switch strategy at this point 
		war = { country = GER country = ENG}
		ai = yes
		control = { province = 527 data = GER } # Germany controls Paris
		control = { province = 643 data = GER } # Germany controls Warszawa
		exists = SOV
	}

	name = "AI_EVENT"
	desc = ""
	style = 0	
	
	date = { day = 1 month = september year = 1940 }
	offset = 30 # Check for trigger conditions every month
	deathdate = { day = 30 month = december year = 1947 }

	action_a = {
				command = { type = ai which = "germany_barbarossa.ai" }
	}

}

#GERMANY SWITCHES TO BARBAROSSA BUILDUP - AUTOMATIC EVENT IN CASE UK IS DEFEATED OR WAR WITH USSR STARTS#

event = {
	id = 10003
	random = no 
	country = GER

	trigger = {
		ai = yes
		control = { province = 527 data = GER } # Germany controls Paris
		control = { province = 643 data = GER } # Germany controls Warszawa
		OR = {
			war = {country = GER country = SOV}
			NOT = {
				war = {country = GER country = ENG}
			}
		}
	}

	name = "AI_EVENT"
	desc = ""
	style = 0

	date = { day = 1 month = january year = 1936 }
	offset = 3 # Check for trigger conditions every 3 days
	deathdate = { day = 30 month = december year = 1947 }

	action_a = {
				command = { type = ai which = "germany_barbarossa.ai" }
	}
}	

#  Switch to Sealion AI preferences if bitter peace.

event = {
	id = 10004
	random = no
	country = GER

	trigger = {
		ai = yes
		OR = {
			event = 2625 # USSR - The Bitter Peace
			event = 2646 # USSR - The Bitter Peace
			NOT = {
				exists = SOV
			}
		}
	}
	
	name = "AI_EVENT"
	style = 0
	
	date = { day = 1 month = january year = 1936 }
	offset = 4 # Check for trigger conditions every four days
	deathdate = { day = 30 month = december year = 1947 }

	action_a = {
		name = "OK"
		command = { type = ai which = "germany_sealion.ai" }
	}
}


#GERMANY TURNS TO DEFENCE#

event = {
	id = 10005
	random = no
	country = GER

	trigger = {
		ai = yes
		war = { country = USA country = GER } # The mighty US has entered the war
		
		#If Germany has still a comfortable position on the continent, then nopes
		NOT = {
			control = { province = 527 data = GER } # Germany controls Paris 
		}
		NOT = {
			control = { province = 643 data = GER } # Germany controls Warszawa
		}
	}

	name = "AI_EVENT"
	desc =""
	style = 0

	date = { day = 1 month = january year = 1936 }
	offset = 3 # Check for trigger conditions every 3 days
	deathdate = { day = 30 month = december year = 1947 }

	action_a = {
				command = { type = ai which = "germany_defense.ai" }
	}
}	

##########################################################################################
#ITALY
##########################################################################################

#ITALY RUNS TO DEFENCE#

event = {
	id = 10006
	random = no
	country = ITA

	trigger = {
		ai = yes
		# Allies are in any province in mainland Italy
		NOT = {
			control = { province = 900 data = ITA } 
			control = { province = 901 data = ITA } 
			control = { province = 902 data = ITA } 
			control = { province = 903 data = ITA }
			control = { province = 905 data = ITA }
			control = { province = 906 data = ITA }
			control = { province = 907 data = ITA }
			control = { province = 908 data = ITA }
			control = { province = 910 data = ITA }
			control = { province = 912 data = ITA }
			control = { province = 914 data = ITA }
			control = { province = 915 data = ITA }
		}
		# And North Africa is lost. Put this here so a 1 division invasion doesn't start panic all over Italy
		NOT = {
			control = { province = 1085 data = ITA } # Tripoli
			control = { province = 1097 data = ITA } # Tobruk
		}
	}

	name = "AI_EVENT"
	desc =""
	style = 0

	date = { day = 1 month = january year = 1936 }
	offset = 3 # Check for trigger conditions every 3 days
	deathdate = { day = 30 month = december year = 1947 }

	action_a = {
				command = { type = ai which = "defensive.ai" }
	}
}	

############################################################################################
#JAPAN
############################################################################################

#WE SHALL NEVER SURRENDER!#

event = {
	id = 10007
	random = no
	country = JAP

	trigger = {
		ai = yes
		war = { country = JAP country = USA }
	#Allies on Japanese Home Islands#
		NOT = {
			control = { province = 1681 data = JAP } 				
			control = { province = 1682 data = JAP } 	
			control = { province = 1683 data = JAP } 	
			control = { province = 1684 data = JAP } 	
			control = { province = 1688 data = JAP } 	
			control = { province = 1818 data = JAP } 				
			control = { province = 1819 data = JAP } 	
			control = { province = 1820 data = JAP } 	
			control = { province = 1821 data = JAP } 	
			control = { province = 1822 data = JAP } 	
			control = { province = 1823 data = JAP } 	
			control = { province = 1824 data = JAP } 	
			control = { province = 1825 data = JAP } 	
			control = { province = 1833 data = JAP } 	
			control = { province = 1834 data = JAP } 	
		}
	}
	# More triggers needed for sure#

	name = "AI_EVENT"
	desc =""
	style = 0

	date = { day = 1 month = january year = 1936 }
	offset = 3 # Check for trigger conditions every 3 days
	deathdate = { day = 30 month = december year = 1947 }

	action_a = {
		command = { type = ai which = "japan_defense.ai" }
	}
}	

#JAPAN LOSES INTEREST IN THE CHINESE CONFLICT#
event = {
	id = 10016
	random = no
	country = JAP

	trigger = {
		ai = yes
		OR = { 
			random = 3
			NOT = {
				exists = CHI
			}
		}
		control = { province = 1563 data = JAP } # Beijing
		control = { province = 1567 data = JAP } # Datong
		control = { province = 1569 data = JAP } # Handan
		control = { province = 1695 data = JAP } # Nanjing
		control = { province = 1698 data = JAP } # Shanghai
	}

	name = "AI_EVENT"
	desc =""
	style = 0

	date = { day = 1 month = january year = 1936 }
	offset = 7 # Check for trigger conditions every 7 days
	deathdate = { day = 30 month = december year = 1947 }

	action_a = {
		command = { type = ai which = "japan_sea.ai" }
	}
}	
#JAPAN REGAINS INTEREST IN THE CHINESE CONFLICT#
event = {
	id = 10017
	random = no
	country = JAP

	trigger = {
		ai = yes
		event = 10016 # TODO: Change this with "persistent" events
		OR = {
			control = { province = 1563 data = CHI } # Beijing
			control = { province = 1567 data = CHI } # Datong
			control = { province = 1569 data = CHI } # Handan
			control = { province = 1695 data = CHI } # Nanjing
			control = { province = 1698 data = CHI } # Shanghai
			control = { province = 1703 data = CHI } # Kowloon
			control = { province = 1710 data = CHI } # Huangshi
			control = { province = 1724 data = CHI } # Haikou
		}
		war = { country = JAP country = CHI }
	}

	name = "AI_EVENT"
	desc =""
	style = 0

	date = { day = 1 month = january year = 1936 }
	offset = 7 # Check for trigger conditions every 7 days
	deathdate = { day = 30 month = december year = 1947 }

	action_a = {
		command = { type = ai which = "japan.ai" }
	}
}	

############################################################################################
#FRANCE
############################################################################################


#20% chance for france to go static defence.. :)
#event = {
#	id = 10008
#	random = no
#	country = FRA
#
#	trigger = {
#		ai = yes
#		random = 10 # Only happens one time in ten
#	}
#	
#	name = "AI_EVENT"
#	desc = "AI_EVENT"
#	style = 0
#	
#	date = { day = 1 month = january year = 1936 }
#
#	action_a = {
#		name = "OK"
#		command = { type = ai which = "France_static.ai" }
#	}
#}

#GERMANY ATTACKS#

event = {
	id = 10009
	random = no
	country = FRA

	trigger = {
		ai = yes
		war = { country = FRA country = GER }
	}

	name ="AI_EVENT"
	desc =""
	style = 0

	date = { day = 1 month = january year = 1936 }
	offset = 3 # Check for trigger conditions every 3 days
	deathdate = { day = 30 month = december year = 1947 }

	action_a = {
				command = { type = ai which = "defensive.ai" }
	}
}				

#FREE FRENCH AI#

event = {
	id = 10010
	random = no
	country = FRA

	trigger = { 
		ai = yes
		exists = VIC
	}

	name = "AI_EVENT"
	desc = ""
	style = 0

	date = { day = 1 month = january year = 1936 }
	offset = 3 # Check for trigger conditions every 3 days
	deathdate = { day = 30 month = december year = 1947 }

	action_a = {
				command = { type = ai which = "free_french.ai" }
	}
}		

#LIBERATION OF FRANCE#

event = {
	id = 10011
	random = no
	country = FRA

	trigger = {
		ai = yes
		event = 2802 # Liberation of France event
	}

	name = "AI_EVENT"
	desc = ""
	style = 0

	date = { day = 1 month = january year = 1936 }
	offset = 3 # Check for trigger conditions every 3 days
	deathdate = { day = 30 month = december year = 1947 }

	action_a = {
				command = { type = ai which = "France.ai" }
	}
}	
		

############################################################################################
#USSR
############################################################################################

#RUSSIAN HORDES#

event = {
	id = 10012
	random = no
	country = SOV

	trigger = {
		ai = yes
		war = { country = SOV country = GER }
		NOT = {
			OR = {
				control = { province = 781 data = SOV } # Smolensk	
				control = { province = 775 data = SOV } # Kiev
				control = { province = 791 data = SOV } # Novgorod
			}
		}
	}
 	
	name ="AI_EVENT"
	desc =""
	style = 0

	date = { day = 1 month = january year = 1936 }
	offset = 3 # Check for trigger conditions every 3 days
	deathdate = { day = 30 month = december year = 1947 }

	action_a = {
				command = { type = ai which = "USSR_defense.ai" }
	}
}							

#THE TIDE TURNS - USSR GOES OFFENSIVE IF ABLE TO PUSH GERMANS BACK#

event = {
	id = 10013
	random = no
	country = SOV

	trigger = {
		ai = yes
		war = { country = SOV country = GER }
		event = 2651 #USSR was being defensive
	# Kiev or Smolensk are in Russian control
		OR = {
			control = { province = 781 data = SOV }
			control = { province = 775 data = SOV }
		}
	# Germany has a second front
		OR = {
			war = { country = GER country = ENG }
			war = { country = GER country = USA }
		}
	}

	name ="AI_EVENT"
	desc =""
	style = 0

	date = { day = 1 month = january year = 1936 }
	offset = 3 # Check for trigger conditions every 3 days
	deathdate = { day = 30 month = december year = 1947 }

	action_a = {
				command = { type = ai which = "USSR.ai" }
	}
}	

#############################################################################################################################
#UK
#############################################################################################################################

#THE TIDE TURNS - UK GOES OFFENSIVE#

event = {
	id = 10014
	random = no
	country = ENG

	trigger = {
		ai = yes
		war = { country = ENG country = GER }
		war = { country = GER country = SOV }
	}
	
	name ="AI_EVENT"
	desc =""
	style = 0

	date = { day = 1 month = january year = 1936 }
	offset = 3 # Check for trigger conditions every 3 days
	deathdate = { day = 30 month = december year = 1947 }

	action_a = {
				command = { type = ai which = "UK_Rebound.ai" }
	}
}	



#############################################################################################################################
#USA
#############################################################################################################################

#THE TIDE TURNS - USA GOES OFFENSIVE#

event = {
	id = 10015
	random = no
	country = USA

	trigger = {
		ai = yes
		war = { country = USA country = GER } # USA comes to save the day
	}
	
	name ="AI_EVENT"
	desc =""
	style = 0

	date = { day = 1 month = january year = 1936 }
	offset = 3 # Check for trigger conditions every 3 days
	deathdate = { day = 30 month = december year = 1947 }

	action_a = {
		command = { type = ai which = "USA_Rebound.ai" }
	}
}

#############################################
#ALLIED CONVOYS
#############################################


############################################
#############################
#  UK-Murmansk Convoy (Rubber, Supplies)
 ##################################################
#######################
event = {
	id = 2115
	random = no
	country = ENG

	trigger = {
		ai = yes
		war = { country = ENG country = GER }
		war = { country = GER country = SOV }
	}
	
	name = "AI_Event"
	desc = ""
	style = 0

	date = { day = 1 month = january year = 1936 }
	offset = 60 # Check for trigger conditions every 60 days
	deathdate = { day = 30 month = december year = 1947 }

	action_a = {
				command = { type = convoy which = 482 value = 822 when = 24 } # Scapa Flow to Murmansk
	}
}

 ##################################################
#######################
#  US-UK Convoy (Oil, Supplies)
 ##################################################
#######################
event = {
	id = 2116
	random = no
	country = USA

	trigger = {
		ai = yes
		war = { country = USA country = GER }
		war = { country = GER country = ENG }
	}
	
	name = "AI_Event"
	desc = ""
	style = 0

	date = { day = 1 month = january year = 1936 }
	offset = 5 # Check for trigger conditions every 5 days
	deathdate = { day = 30 month = december year = 1947 }

	action_a = {
				command = { type = convoy which = 125 value = 489 when = 17 } # Boston to Manchester
	}
}

##################################################
#######################
#  Canada-UK Convoy (Steel, Supplies)
##################################################
#######################

event = {
	id = 2117
	random = no
	country = CAN

	trigger = {
		ai = yes
		atwar = yes
		atwar = ENG
	}
	
	name = "AI_Event"
	desc = ""
	style = 0

	date = { day = 1 month = january year = 1936 }
	offset = 5 # Check for trigger conditions every 5 days
	deathdate = { day = 30 month = december year = 1947 }

	action_a = {
				command = { type = convoy which = 153 value = 489 when = 18 } #Halifax to Manchester
	}
}


#####################
#ITALY JOINS THE AXIS
#####################

event = {
 id = 2143 
 trigger = { ai = yes }
 random = no
 country = GER
 name = "AI_Event"
 desc = ""
 style = 0
 date = { day = 8 month = june year = 1940 }
 offset = 5
 deathdate = { day = 10 month = june year = 1944 }
 action_a = {
	name = ""
	command = { }
	}
  }

event = {
 id = 10020
 trigger = {
	ai = yes
	government = fascist
	event = 2143
	NOT = { 
		alliance = { country = ITA country = GER }
		alliance = { country = ITA country = SOV }
		alliance = { country = ITA country = ENG }
		}
	control = { province = 556 data = GER } #Chaumont
	control = { province = 520 data = GER } #Sedan
	control = { province = 518 data = GER } #Lille
	random = 30
	war = { country = GER country = FRA }
		}
 random = no
 country = ITA
 name = "AI_Event"
 desc = ""
 style = 0
 date = { day = 10 month = june year = 1940 }
 offset = 5 #Check for triggers every 5 days
 deathdate = { day = 10 month = june year = 1944 }

 action_a = {
	name = ""
	command = { type = trigger which = 2140 }
	}
 }


event = {
 id = 2140
 random = no
 country = GER
 name = "AI_Event"
 desc = ""
 style = 0
 action_a = {
	name = ""
	command = { type = alliance which = ITA }
		}
	}

##############################################
###TRIPARTITE PACT BETWEEN JAPAN-GERMANY-ITALY
##############################################

event = {
 id = 10022
 trigger = {
	ai = yes
	government = fascist
	NOT = {
		war = { country = ITA country = GER }
		war = { country = ITA country = JAP }
		war = { country = GER country = JAP }
		}
	}
 random = no
 country = GER
 name = "AI_Event"
 desc = ""
 style = 0
 date = { day = 27 month = september year = 1940 }
 offset = 20 #Check for triggers every 20 days
 deathdate = { day = 27 month = september year = 1944 }
 
 action_a = {
	name = ""
	command = { type = trigger which = 10023 } #Choice for Italy
		}
 action_b = {
	name = ""
	command = { }
		}
	}

event = {
 id = 10023
 trigger = {
	ai = yes
	government = fascist
		}
 random = no
 country = ITA
 name = "AI_Event"
 desc = ""
 style = 0
 
 action_a = {
	name = ""
	command = { type = trigger which = 10024 } #Choice for Japan
		}
 action_b = {
	name = ""
	command = { }
		}
	}

event = {
 id = 10024
 trigger = {
	ai = yes
	government = fascist
		}
 random = no
 country = JAP
 name = "AI_Event"
 desc = ""
 style = 0
 
 action_a = {
	name = ""
	command = { type = trigger which = 10025 } #Techs for Germany
		}
 action_b = {
	name = ""
	command = { }
		}
	}

event = {
 id = 10025
 random = no
 country = GER
 name = "AI_Event"
 desc = ""
 style = 0
 
 action_a = {
	name = ""
	command = { type = steal_tech which = JAP }
	command = { type = steal_tech which = JAP }
	command = { type = steal_tech which = JAP }
	command = { type = steal_tech which = JAP }
	command = { type = steal_tech which = JAP }
	command = { type = steal_tech which = ITA }
	command = { type = steal_tech which = ITA }
	command = { type = steal_tech which = ITA }
	command = { type = steal_tech which = ITA }
	command = { type = steal_tech which = ITA }
	command = { type = coalpool value = 10000 }
	command = { type = steelpool value = 10000 }
	command = { type = oilpool value = 10000 }
	command = { type = trigger which = 10026 }
		}
	}

event = {
 id = 10026
 random = no
 country = ITA
 name = "AI_Event"
 desc = ""
 style = 0
 
 action_a = {
	name = ""
	command = { type = steal_tech which = JAP }
	command = { type = steal_tech which = JAP }
	command = { type = steal_tech which = JAP }
	command = { type = steal_tech which = JAP }
	command = { type = steal_tech which = JAP }
	command = { type = steal_tech which = GER }
	command = { type = steal_tech which = GER }
	command = { type = steal_tech which = GER }
	command = { type = steal_tech which = GER }
	command = { type = steal_tech which = GER }
	command = { type = coalpool value = 10000 }
	command = { type = steelpool value = 10000 }
	command = { type = oilpool value = 10000 }
	command = { type = trigger which = 10027 }
		}
	}

event = {
 id = 10027
 random = no
 country = JAP
 name = "AI_Event"
 desc = ""
 style = 0
 
 action_a = {
	name = ""
	command = { type = steal_tech which = ITA }
	command = { type = steal_tech which = ITA }
	command = { type = steal_tech which = ITA }
	command = { type = steal_tech which = ITA }
	command = { type = steal_tech which = ITA }
	command = { type = steal_tech which = GER }
	command = { type = steal_tech which = GER }
	command = { type = steal_tech which = GER }
	command = { type = steal_tech which = GER }
	command = { type = steal_tech which = GER }
	command = { type = coalpool value = 10000 }
	command = { type = steelpool value = 10000 }
	command = { type = oilpool value = 10000 }
		}
	}


#####################
#NatChi getting techs
#####################

event = {
id = 5038
random = no
country = JAP

trigger = { ai = yes }

name = "AI_Event"
desc = ""
style = 0

date = { day = 1 month = january year = 1936 }
offset = 1
deathdate = { day = 6 month = january year = 1936 }

action_a = { command = {} }
}

event = {
id = 5039
random = no
country = CHI

trigger = {
ai = yes
NOT = { event = 5038 }
}

name = "AI_Event"
desc = ""
style = 0

date = { day = 7 month = january year = 1936 }
offset = 1 
deathdate = { day = 9 month = january year = 1936 }

action_a = { command = { type = gain_tech which = 1200 }
command = { type = gain_tech which = 1201 }
command = { type = gain_tech which = 14000 }
command = { type = gain_tech which = 14003 }
command = { type = gain_tech which = 4100 }
command = { type = gain_tech which = 4101 }
command = { type = gain_tech which = 4102 }
command = { type = gain_tech which = 4200 }
command = { type = gain_tech which = 4201 }
command = { type = gain_tech which = 4202 }
command = { type = gain_tech which = 4203 }
command = { type = gain_tech which = 4204 }
command = { type = gain_tech which = 4300 }
}
}

########################
#BULGARIA JOINS THE AXIS
########################

event = {
 id = 2142 
 trigger = { ai = yes }
 random = no 
 country = GER
 name = "AI_Event"
 desc = ""
 style = 0
 date = { day = 8 month = june year = 1940 }
 offset = 5
 deathdate = { day = 10 month = june year = 1944 }
 action_a = {
	name = ""
	command = { }
		}
  }

event = {
 id = 10028
 trigger = {
	event = 2142
	government = fascist
	ai = yes
	NOT = { 
		alliance = { country = BUL country = GER }
		alliance = { country = BUL country = SOV }
		alliance = { country = BUL country = ENG }
		}
	random = 30
	war = { country = GER country = ENG }
		}
 random = no
 country = BUL
 name = "AI_Event"
 desc = ""
 style = 0
 date = { day = 10 month = june year = 1940 }
 offset = 5 #Check for triggers every 5 days
 deathdate = { day = 10 month = june year = 1944 }

 action_a = {
	name = ""
	command = { type = trigger which = 2141 }
	}
 action_b = {
	name = ""
	command = { }
 	}
 }

event = {
 id = 2141
 random = no
 country = GER
 name = "AI_Event"
 desc = ""
 style = 0
 action_a = {
  name = ""
  command = { type = alliance which = BUL }
  		}
   }


##########################
###HUNGARY JOINS THE AXIS
##########################

event = {
 id = 2144
 trigger = { ai = yes }
 random = no
 country = GER
 name = "AI_Event"
 desc = ""
 style = 0
 date = { day = 18 month = december year = 1940 }
 offset = 10
 deathdate = { day = 20 month = december year = 1944 }
 action_a = {
	name = ""
	command = { }
	}
  }

event = {
 id = 2130
 trigger = {
	ai = yes
	government = fascist
	event = 2144
	random = 30
	NOT = {
		alliance = { country = HUN country = GER }
		alliance = { country = HUN country = SOV }
		alliance = { country = HUN country = ENG }
		}
	}
 random = no
 country = HUN
 name = "AI_Event"
 desc = ""
 style = 0
 date = { day = 20 month = december year = 1940 }
 offset = 10
 deathdate = { day = 20 month = december year = 1944 }

 action_a = {
	name = ""
	command = { type = trigger which = 2145 }
		}
 action_b = {
	name = ""
	command = { }
		}
	}

event = {
 id = 2145
 random = no
 country = GER
 name = "AI_Event"
 desc = ""
 style = 0
 action_a = {
	name = ""
	command = { type = alliance which = HUN }
	}
  }


#########################
###ROMANIA JOINS THE AXIS
#########################

event = {
 id = 2146 
 trigger = { ai = yes }
 random = no 
 country = GER
 name = "AI_Event"
 desc = ""
 style = 0
 date = { day = 21 month = december year = 1940 }
 offset = 5
 deathdate = { day = 23 month = december year = 1944 }
 action_a = {
	name = ""
	command = { }
		}
  }

event = {
 id = 2131
 trigger = {
	ai = yes
	NOT = {
		war = { country = GER country = ROM }
	      }
	event = 2146
	random = 30
	government = fascist
	NOT = {
		alliance = { country = ROM country = GER }
		alliance = { country = ROM country = SOV }
		alliance = { country = ROM country = ENG }
		}
	}
 random = no
 country = ROM
 name = "AI_Event"
 desc = ""
 style = 0
 date = { day = 23 month = december year = 1940 }
 offset = 10
 deathdate = { day = 23 month = december year = 1944 }

 action_a = {
	name = ""
	command = { type = trigger which = 2147 }
		}
 action_b = {
	name = ""
	command = { }
		}
	}

event = {
 id = 2147
 random = no
 country = GER
 name = "AI_Event"
 desc = ""
 style = 0
 action_a = {
  name = ""
  command = { type = alliance which = ROM }
  		}
   }


################################################
#NatChi joins the Allies when JAP had dow'ed USA
################################################

event = {
 id = 2158
 random = no
 trigger = {
	ai = yes
	war = { country = JAP country = CHI } #Japan has DOW'ed China
	war = { country = ENG country = GER } #Axis is at war with the Allies
	alliance = { country = JAP country = GER } #Japan has gone Axis
	NOT = {
		alliance = { country = CHI country = USA } #If UK is already annexed
		alliance = { country = CHI country = ENG } #China shouldn't be Allied yet
		alliance = { country = CHI country = GER } #China shouldn't be Axis either
		alliance = { country = CHI country = SOV } #China shouldn't be Comintern
		alliance = { country = GER country = ENG } #England shouldn't have left the Allies
	      }
	}
 country = CHI
 date = { day = 2 month = january year = 1937 }
 offset = 10
 deathdate = { day = 30 month = december year = 1947 }
 name = "AI_Event"
 desc = ""
 style = 0
 action_a = {
	name = ""
	command = { type = alliance which = ENG }
	command = { type = alignment which = democratic value = 100 }
	command = { type = dissent value = -10 }
	    }
	}


###################################################
###AI Cheats - Conversion techs
###################################################

event = {
	id = 5030
	random = no
	country = GER
	
                trigger = { 
                ai = yes     
                      }

	name = "AI_Event"
	desc = ""
        style = 0

	date = { day = 1 month = january year = 1936 }
	offset = 5
	deathdate = { day = 1 month = february year = 1936 }

	action_a = {
		name = ""
                command = { type = gain_tech which = 4400 }
                command = { type = gain_tech which = 4500 } 
                command = { type = gain_tech which = 4600 }
                command = { type = gain_tech which = 4601 } 
                command = { type = gain_tech which = 4700 }
                command = { type = gain_tech which = 4701 } 
                }
	}

event = {
	id = 5031
	random = no
	country = JAP
	
                trigger = { 
                ai = yes     
                      }

	name = "AI_Event"
	desc = ""
        style = 0

	date = { day = 1 month = january year = 1936 }
	offset = 5
	deathdate = { day = 1 month = february year = 1936 }

	action_a = {
		name = ""
                command = { type = gain_tech which = 4400 }
                command = { type = gain_tech which = 4500 } 
                command = { type = gain_tech which = 4600 }
                command = { type = gain_tech which = 4601 } 
                command = { type = gain_tech which = 4700 }
                command = { type = gain_tech which = 4701 } 
                }
	}

event = {
	id = 5032
	random = no
	country = ITA
	
                trigger = { 
                ai = yes     
                      }

	name = "AI_Event"
	desc = ""
        style = 0

	date = { day = 1 month = january year = 1936 }
	offset = 5
	deathdate = { day = 1 month = february year = 1936 }

	action_a = {
		name = ""
                command = { type = gain_tech which = 4400 }
                command = { type = gain_tech which = 4500 } 
                command = { type = gain_tech which = 4600 }
                command = { type = gain_tech which = 4601 } 
                command = { type = gain_tech which = 4700 }
                command = { type = gain_tech which = 4701 } 
                }
	}

event = {
	id = 5033
	random = no
	country = ENG
	
                trigger = { 
                ai = yes     
                      }

	name = "AI_Event"
	desc = ""
        style = 0

	date = { day = 1 month = january year = 1936 }
	offset = 5
	deathdate = { day = 1 month = february year = 1936 }

	action_a = {
		name = ""
                command = { type = gain_tech which = 4400 }
                command = { type = gain_tech which = 4500 } 
                command = { type = gain_tech which = 4600 }
                command = { type = gain_tech which = 4601 } 
                command = { type = gain_tech which = 4700 }
                command = { type = gain_tech which = 4701 } 
                }
	}

event = {
	id = 5034
	random = no
	country = USA
	
                trigger = { 
                ai = yes     
                      }

	name = "AI_Event"
	desc = ""
        style = 0

	date = { day = 1 month = january year = 1936 }
	offset = 5
	deathdate = { day = 1 month = february year = 1936 }

	action_a = {
		name = ""
                command = { type = gain_tech which = 4400 }
                command = { type = gain_tech which = 4500 } 
                command = { type = gain_tech which = 4600 }
                command = { type = gain_tech which = 4601 } 
                command = { type = gain_tech which = 4700 }
                command = { type = gain_tech which = 4701 } 
                }
	}

event = {
	id = 5035
	random = no
	country = SOV
	
                trigger = { 
                ai = yes     
                      }

	name = "AI_Event"
	desc = ""
        style = 0

	date = { day = 1 month = january year = 1936 }
	offset = 5
	deathdate = { day = 1 month = february year = 1936 }

	action_a = {
		name = ""
                command = { type = gain_tech which = 4400 }
                command = { type = gain_tech which = 4500 } 
                command = { type = gain_tech which = 4600 }
                command = { type = gain_tech which = 4601 } 
                command = { type = gain_tech which = 4700 }
                command = { type = gain_tech which = 4701 } 
                }
	}

#######id 5037 also used!!!!!!


###########################################################################
###Netherlands move capital to the Dutch East Indies when nearly conquered
###########################################################################

event = {
	id = 5036
	random = no
	country = HOL
	
                trigger = { 
                ai = yes 
           	war = { country = GER country = HOL }                          
        }

	name = "ai_event"
	desc = ""
        style = 0

	date = { day = 1 month = january year = 1936 }
	offset = 3
	deathdate = { day = 1 month = december year = 1946 }

	action_a = {
		name = ""
                command = { type = capital which = 1950 } # surabaya
                }
	}


################################################################
###Belgium moves its capital to the Kongo when nearly conquered
################################################################

event = {
	id = 5040
	random = no
	country = BEL
	
                trigger = { 
                ai = yes 
        	war = { country = GER country = BEL }                       
                       }

	name = "ai_event"
	desc = ""
        style = 0

	date = { day = 1 month = january year = 1936 }
	offset = 3
	deathdate = { day = 1 month = december year = 1946 }

	action_a = {
		name = ""
                command = { type = capital which = 1130 } # Leopoldville
             }
	}

### And moves back if puppeted afterwards

event = {
	id = 5060
	country = BEL
	
	trigger = {
		ai = yes
		event = 5040
		puppet = { country = BEL country = GER }
		}

	name = "AI_Event"
	desc = ""
	style = 0
	
	date = { day = 1 month = january year = 1936 }
	offset = 3
	deathdate = { day = 1 month = december year = 1946 }
	
	action_a = {
		name = ""
		command = { type = capital which = 552 }
		}
	}
	


#################################################################
###USSR moves its capital if threatened
#################################################################

event = {
	id = 5043
	random = no
	country = SOV
		trigger = {
			ai = yes
			atwar = yes
			NOT = {
				control = { province = 778 data = -1 } #Minsk has fallen
				control = { province = 781 data = -1 } #Smolensk has fallen
				control = { province = 784 data = -1 } #Vitebsk has fallen
				control = { province = 852 data = -1 } #Kaluga has fallen
				}
			}

	name = "AI_Event"
	desc = ""
	style = 0
	date = { day = 2 month = january year = 1936 }
	offset = 3 #Check for triggers every three days
	deathdate = { day = 30 month = december year = 1947 }

		action_a = {
			name = ""
			command = { type = capital which = 1373 } #Move capital to Kujbysjev according to secret plans
				}
	}


##################################################
#######################
# Coup in Yugoslavia
##################################################
#######################
event = { 
id = 3515
random = no
country = YUG

trigger = {
ai=yes 
random = 50
alliance = { country = YUG country = GER }
alliance = { country = ITA country = GER }
NOT = { 
exists = POL
exists = CZE
exists = AUS
alliance = { country = GER country = SOV }
event = 2031
alliance = { country = YUG country = ENG }
alliance = { country = YUG country = SOV }
}
}

name = "AI_Event"
desc = " "

style = 0

date = { day = 1 month = january year = 1936 }
offset = 1 # Check for trigger conditions every day
deathdate = { day = 30 month = december year = 1947 }

action_a = {
command = { type = leave_alliance }
command = { type = end_access which = GER }
command = { type = peace which = ENG value = 1 }
command = { type = peace which = PHI value = 1 }
command = { type = peace which = FRA value = 1 }
command = { type = peace which = USA value = 1 }
command = { type = peace which = SOV value = 1 }
command = { type = peace which = NOR value = 1 }
command = { type = peace which = DEN value = 1 }
command = { type = peace which = SWE value = 1 }
command = { type = peace which = GRE value = 1 }
command = { type = peace which = HUN value = 1 }
command = { type = peace which = BUL value = 1 }
command = { type = peace which = ROM value = 1 }
command = { type = peace which = BEL value = 1 }
command = { type = peace which = HOL value = 1 }
command = { type = peace which = EST value = 1 }
command = { type = peace which = LAT value = 1 }
command = { type = peace which = LIT value = 1 }
command = { type = peace which = LUX value = 1 }
command = { type = peace which = TUR value = 1 }
command = { type = peace which = IRE value = 1 }
command = { type = peace which = ITA value = 1 }
command = { type = peace which = SPA value = 1 }
command = { type = peace which = ALB value = 1 }
command = { type = peace which = CHI value = 1 }
command = { type = peace which = FIN value = 1 }
command = { type = peace which = SPR value = 1 }
command = { type = peace which = CHC value = 1 }
command = { type = peace which = SCH value = 1 }
command = { type = peace which = BHU value = 1 }
command = { type = peace which = OMN value = 1 }
command = { type = peace which = YEM value = 1 }
command = { type = peace which = LIB value = 1 }
command = { type = peace which = NEP value = 1 }
command = { type = peace which = AFG value = 1 }
command = { type = peace which = ARG value = 1 }
command = { type = peace which = BRA value = 1 }
command = { type = peace which = CAN value = 1 }
command = { type = peace which = AST value = 1 }
command = { type = peace which = NZL value = 1 }
command = { type = peace which = VEN value = 1 }
command = { type = peace which = CZE value = 1 }
command = { type = peace which = BOL value = 1 }
command = { type = alignment which = democratic value = 100 }
command = { type = headofstate which = 20001 }
command = { type = headofgovernment which = 20033 }
command = { type = foreignminister which = 20013 }
command = { type = armamentminister which = 20014 }
command = { type = ministerofsecurity which = 20015 }
command = { type = ministerofintelligence which = 20016 }
command = { type = chiefofstaff which = 20017 }
command = { type = chiefofarmy which = 20018 }
command = { type = chiefofnavy which = 20019 }
command = { type = chiefofair which = 20020 } 
command = { type = trigger which = 3531 } 
}
}

##################################################
#######################
# Yugoslavia joins the Allies
##################################################
#######################
event = { 
id = 3531
random = no
country = YUG

#triggered by 3515 

name = "AI_Event"
desc = " "

style = 0

action_a = {
command = { type = alliance which = ENG }

}
}


#####################################################
### Australia switches AI when at war with the Axis
#####################################################

event = {
 id = 5045 
 random = no
 country = AST
 trigger = {
	ai = yes	
	war = { country = AST country = GER }
		}
 name = "AI_Event"
 desc = ""
 style = 0
 
 date = { day = 1 month = january year = 1936 }
 offset = 5
 deathdate = { day = 30 month = december year = 1946 }

 action_a = {
	command = { type = ai which = "Australia_War.ai" }
	}
 }


##################################################
### Brazil switches AI when at war with the Axis
##################################################

event = {
 id = 5046 
 random = no
 country = BRA
 trigger = {
	ai = yes	
	war = { country = BRA country = GER }
		}
 name = "AI_Event"
 desc = ""
 style = 0
 
 date = { day = 1 month = january year = 1936 }
 offset = 5
 deathdate = { day = 30 month = december year = 1946 }

 action_a = {
	command = { type = ai which = "Brazil_War_allies.ai" }
	}
 }


###################################################
### Canada switches AI when at war with the Axis
###################################################

event = {
 id = 5047 
 random = no
 country = CAN
 trigger = {
	ai = yes	
	war = { country = CAN country = GER }
		}
 name = "AI_Event"
 desc = ""
 style = 0
 
 date = { day = 1 month = january year = 1936 }
 offset = 5
 deathdate = { day = 30 month = december year = 1946 }

 action_a = {
	command = { type = ai which = "Canada_War.ai" }
	}
 }

########################################################
### New Zealand switches AI when at war with the Axis
########################################################

event = {
 id = 5048 
 random = no
 country = NZL
 trigger = {
	ai = yes	
	war = { country = NZL country = GER }
		}
 name = "AI_Event"
 desc = ""
 style = 0
 
 date = { day = 1 month = january year = 1936 }
 offset = 5
 deathdate = { day = 30 month = december year = 1946 }

 action_a = {
	command = { type = ai which = "New_Zealand_War.ai" }
	}
 }


########################################################
### South Africa switches AI when at war with the Axis
########################################################

event = {
 id = 5049 
 random = no
 country = SAF
 trigger = {
	ai = yes	
	war = { country = SAF country = GER }
		}
 name = "AI_Event"
 desc = ""
 style = 0
 
 date = { day = 1 month = january year = 1936 }
 offset = 5
 deathdate = { day = 30 month = december year = 1946 }

 action_a = {
	command = { type = ai which = "South_Africa_War.ai" }
	}
 }


######################################################
###  End of Tannu Tuva
######################################################

event = {
        id = 1500
        random = no
        country = TAN
        
        trigger = {  ai = yes    }

        name = "AI_EVENT"
        desc = ""
        style = 0
        
        date = { day = 1 month = january year = 1944 }
        offset = 15
        deathdate = { day = 30 month = february year = 1944 }
        
        action_a = { }
}


event = {
        id = 1501
        random = no
        country = SOV
        
        trigger = {
                event = 1500
                ai = yes     
                alliance = { country = SOV country = TAN }
                }

        name = "AI_EVENT"
        desc = ""
        style = 0
        
       date = { day = 1 month = january year = 1944 }
        offset = 15
        deathdate = { day = 30 month = february year = 1944 }
        
        action_a = {
                command = { type = inherit which = TAN }
		command = { type = addcore which = 1534 }
        }
}


# Use id's from 5061 on